{include file='public/head'}
{include file='public/left'}
<!-- content -->

<div class="main_02_r">

    <!--内容区域-->
    <div class="site_01">
        <span>当前位置：</span><a href="#">城事社</a><i>></i><a href="#">角色管理</a><i>></i><a href="#">用户管理</a>
    </div>

    <div class="nrq_01">
        <div class="gg_01">
            <span class="on">用户管理</span><span><a href="{:url('user/merchant')}">商家管理</a></span>
        </div>
        <div class="gg_02">
            <div class="gg_03">

                <div class="gg_03_t">
                    <em class="fr">
                        <form method="get">
                            <input type="text" name="search" value="{$search}" placeholder="请输入昵称、职位关键词" class="gg_03_txt" />
                            <input type="submit" value="" class="gg_03_btn" />
                        </form>
                    </em>
                </div>

                <div class="flxx_01">
                    <table cellpadding="0" cellspacing="0">
                        <tr>
                            <th>序号</th>
                            <th>昵称</th>
                            <th>头像</th>
                            <th>电话</th>
                            <th>公司</th>
                            <th>职务</th>
                            <th>地址</th>
                            <th>签名</th>
                            <th>风格</th>
                            <th>操作</th>
                        </tr>
                        {volist name="arr" id="vo"}
                        <tr>
                            <td>{$vo.user_id}</td>
                            <td>{$vo.nick_name|substr=0,15}</td>
                            <td><img src="{$vo.avatar}" class="img_01" /></td>
                            <td>{$vo.mobile}</td>
                            <td>{$vo.company}</td>
                            <td>{$vo.duty}</td>
                            <td>{$vo.address}</td>
                            <td>{$vo.signature}</td>
                            <td>
                                {if condition="$vo.card_style == 1"}
                                    橙色
                                {elseif condition="$vo.card_style == 2"/}
                                    青色
                                {elseif condition="$vo.card_style == 3"/}
                                    蓝色
                                {elseif condition="$vo.card_style == 4"/}
                                    绿色
                                {elseif condition="$vo.card_style == 5"/}
                                    紫色
                                {/if}
                            </td>
                            <td>
                                <a href="javascript:ajax_delete('{$vo.user_id}');" class="a1">删除</a>
                            </td>
                        </tr>
                        {/volist}
                    </table>
                </div>

                <div class="gg_03_b">
                    <div class="fl">
                        <span>共 <i>{$arr->total()}</i> 条</span><span>每页 <i>{$arr->listRows()}</i> 条</span>
                    </div>
                    <div class="fr">
                        {$arr->render()}
                    </div>
                </div>
            </div>
        </div>

    </div>

</div>
<script type="text/javascript">
    var layer = layui.layer,form = layui.form;
    function ajax_delete(id) {
        $.ajax({
            url: "{:url('user/ajax_delete')}",
            type: "POST",//方法类型
            // dataType: "json",//预期服务器返回的数据类型
            data: {"id":id},
            success: function (data) {
                if (data.code === 1) {
                    layer.msg("<span style='margin-left: 18px;'>" + data.msg + "</span>", {
                        icon: 1,
                        time: 1000
                    }, function () {
                        window.location.href = data.url;
                    });
                } else {
                    layer.msg("<span style='margin-left: 18px;'>" + data.msg + "</span>", {
                        icon: 2,
                        time: 1000
                    }, function () {
                        /*if(data.url){
                        window.location.href=data.url;
                    }else{
                        location.reload();
                    }*/
                    });
                }
            },
            error: function () {
                layer.msg("<span style='margin-left: 18px;'>请求错误,请联系管理员</span>", {
                    icon: 0,
                    time: 1000
                }, function () {
                    //location.reload();
                });
            }
        });
    }
</script>
<!-- content -->
{include file='public/foot'}